<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>03-单元素/组件的入场和出场 过渡和动画</title>
    <link
    rel="stylesheet"
    href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"
  />
    <style>
      @keyframes move {
        0% {
          transform: translateX(-100px);
        }

        50% {
          transform: translateX(-50px);
        }

        75% {
          transform: translateX(50px);
        }

        100% {
          transform: translateX(0);
        }
      }

      /*.v-enter-from{
          opacity: 0;
      }*/
      /*.hello{
        animation: move 2s ease-in;
      }

      .bye{
        animation: move 2s ease-in;
      }*/

      .v-enter-from{
          color: red;
      }
      

      .v-enter-active,
      .v-leave-active {
        /*transition: opacity 2s ease;*/
        animation: move 2s ease-in;
        transition: all 2s ease;
      }

      .v-leave-active{
          color: red;
      }


      /*.v-enter-to{
          opacity: 1;
      }*/

      /*.v-leave-to{
          opacity: 0;
      }*/
    </style>
  </head>
  <body>
    <script src="https://unpkg.com/vue@next"></script>
    <div id="root"></div>

    <script>
      const app = Vue.createApp({
        data() {
          return {
            show: false,
          };
        },

        methods: {
          handleClick() {
            this.show = !this.show;
          },
        },

        //template: `
        //        <transition name="yunmu"
        //            enter-from-class=""
        //            enter-active-class="hello"
        //            enter-to-class=""

        //            leave-from-class=""
        //            leave-active-class="bye"
        //            leave-to-class=""
        //        >
        //           <div v-show="show">hello world</div>
        //        </transition> 
        //           <button @click="handleClick">切换</button>  
        //        `,
    //    template: `
    //            <transition name="yunmu"  
    //                enter-active-class="animate__animated animate__flash"
    //                leave-active-class="animate__animated animate__swing"
       
    //            >
    //               <div v-show="show">hello world</div>
    //            </transition> 
    //               <button @click="handleClick">切换</button>  
    //            `,
    //  });
        template: `
                <transition>
                   <div v-show="show">hello world</div>
                </transition> 
                   <button @click="handleClick">切换</button>  
                `,
      });

      const vm = app.mount("#root");
    </script>
  </body>
</html>
